# -*- coding: utf-8 -*-
# https://blog.csdn.net/weixin_52040868
# 公众号：测个der
# 微信：qing_an_an

import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5 import QtCore


class QWIN(QWidget):
    def __init__(self):
        super(QWIN, self).__init__()
        layout = QHBoxLayout()
        self.label = QLabel("Set Style:")
        self.box = QComboBox()
        # 从QStyleFactory中增加多个显示样式
        self.box.addItems(QStyleFactory.keys())

        index = self.box.findText(
            QApplication.style().objectName(),
            QtCore.Qt.MatchFixedString
        )
        self.box.setCurrentIndex(index)
        self.box.activated[str].connect(self.handleStyleChanged)
        layout.addWidget(self.label)
        layout.addWidget(self.box)
        self.setLayout(layout)

    def handleStyleChanged(self,style):
        QApplication.setStyle(style)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    win = QWIN()
    win.show()
    sys.exit(app.exec_())
